<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/frameset.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<STYLE type=text/css>

BODY {
	FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: 宋体
}
TD {
	FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: 宋体
}
.error{
	color: red
}
</STYLE>
<!-- 引入JQ -->
<script type="text/javascript" src="${ pageContext.request.contextPath }/js/jquery-1.4.4.min.js"></script>
<META content="MSHTML 6.00.6000.16809" name=GENERATOR></HEAD>
<BODY>
<FORM id=form1 name=form1 action="${pageContext.request.contextPath }/user_regist.action" 
 onsubmit="return checkForm()" method=post>

<DIV id=UpdatePanel1>
<DIV id=div1 
style="LEFT: 0px; POSITION: absolute; TOP: 0px; BACKGROUND-COLOR: #0066ff"></DIV>
<DIV id=div2 
style="LEFT: 0px; POSITION: absolute; TOP: 0px; BACKGROUND-COLOR: #0066ff"></DIV>


<DIV>&nbsp;&nbsp; </DIV>
<DIV>
<TABLE cellSpacing=0 cellPadding=0 width=900 align=center border=0>
  <TBODY>
  <TR>
    <TD style="HEIGHT: 105px"><IMG src="images/login_1.gif" 
  border=0></TD></TR>
  <TR>
    <TD background=images/login_2.jpg height=300>
      <TABLE height=300 cellPadding=0 width=900 border=0>
        <TBODY>
        <TR>
          <TD colSpan=2 height=35></TD></TR>
        <TR>
          <TD width=360></TD>
          <TD>
            <TABLE cellSpacing=0 cellPadding=2 border=0>
              <TBODY>
              <TR>
                <TD style="HEIGHT: 28px" width=80>登 录 名：</TD>
                <TD style="HEIGHT: 28px" width=150><INPUT id="user_code" 
                  style="WIDTH: 130px" name="user_code" onblur="checkCode()"></TD>
                <TD style="HEIGHT: 28px" width=370><SPAN 
                  id=RequiredFieldValidator3   style="FONT-WEIGHT: bold"></SPAN></TD></TR>
              <TR>
                <TD style="HEIGHT: 28px">登录密码：</TD>
                <TD style="HEIGHT: 28px"><INPUT id="user_password" style="WIDTH: 130px" 
                  type=password name="user_password"></TD>
                <TD style="HEIGHT: 28px"><SPAN id=RequiredFieldValidator4 
                  style="FONT-WEIGHT: bold; VISIBILITY: hidden; COLOR: white">请输入密码</SPAN></TD></TR>
              <TR>
                <TD style="HEIGHT: 28px">验证码：</TD>
                <TD style="HEIGHT: 28px"><INPUT id=txtcode 
                  style="WIDTH: 130px" name=txtcode></TD>
                <TD style="HEIGHT: 28px">&nbsp;</TD></TR>
              <TR>
                <TD style="HEIGHT: 18px"></TD>
                <TD style="HEIGHT: 18px"></TD>
                <TD style="HEIGHT: 18px"></TD></TR>
              <TR>
                <TD></TD>
                <TD><INPUT  type="submit" value="注册"> 
              </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD><IMG src="images/login_3.jpg" 
border=0></TD></TR></TBODY></TABLE></DIV></DIV>


</FORM></BODY>
<script type="text/javascript">
<!--判断用户名是否已经存 先判断是否为空，为空则显示提示信息 -->
	function checkCode(){
		var user_code=$("#user_code").val();
		if(user_code.trim()==""){
			$("#RequiredFieldValidator3").html("请输入用户名");
			$("#RequiredFieldValidator3").addClass("error");
		}else{
			//发送ajax请求判断
			var url="${pageContext.request.contextPath}/user_checkUserName.action";
			var params={"user_code":user_code};
			$.post(url,params,function(data){
				//如果有数据而且==yes,则用户名不重复
				if(data && data == "yes"){
					$("#RequiredFieldValidator3").html("");
					$("#RequiredFieldValidator3").removeClass("error");
				}else{
					$("#RequiredFieldValidator3").html("用户名重复");
					$("#RequiredFieldValidator3").addClass("error");
				}
			},"json");
		}
	}
	
	function checkForm(){
		checkCode();
		//检查是否有错误，有的haul，发挥fasle,没有的话，提交
		var num=$("#error").size();
		if(num>0){
			return false;
		}
	}
</script>

</HTML>


